<?php
/**
 * Run javascript code that user saved
 */
require_once(dirname(__FILE__) . "/start.inc");
global $CONFIG;

header('Content-type:application/x-javascript');

//error_log('------>'.$CONFIG->getLocalhostUrl());
//error_log('------->'.var_export($_SERVER, true));
$vId = (int) getVar('vId');
// get login user
$user = get_loggedin_user();
if ($user && $vId) {
    $version = new CodeVersion($vId);
    $code = $version->getCode();
    echo $code;
}
exit;